package com.nuonuo.middleware.controller;

import com.nuonuo.middleware.utils.HttpClientUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author duan
 * @version 1.0
 * @date 2024/3/7 14:18
 */
@RestController
@RequestMapping(value = "/proxy")
public class ProxyController {

    @GetMapping(value = "withoutProxy")
    public String withoutProxy() throws Exception {
        String result = HttpClientUtil.get("http://www.baidu.com", 3000, null);
        System.out.println("result = " + result);
        return result;
    }

    @GetMapping(value = "withProxy")
    public String withProxy() throws Exception {
        String result = HttpClientUtil.getWithProxy("http://www.baidu.com", 3000, null);
        System.out.println("result = " + result);
        return result;
    }
    
}
